package com.thti.mecool.client.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("serial")
public class PageResult implements Serializable{
	private int start;
	private int current = 1;
	private int pageSize = 10;
	private int totalRecord;//总记录
	private int totalPage;//总页数
	private boolean reverse = false;
	private boolean pre;
	private boolean next;//是否有下一页

	private List<String> dates = new ArrayList<String>();
	@SuppressWarnings("rawtypes")
	private List list = new ArrayList();

	@SuppressWarnings("rawtypes")
	public List getList() {
		return list;
	}

	@SuppressWarnings("rawtypes")
	public void setList(List list) {
		this.list = list;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getCurrent() {
		return current;
	}

	public void setCurrent(int current) {
		this.current = current;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
		this.totalPage = (this.totalRecord + this.pageSize - 1) / this.pageSize;

		if (this.current > this.totalPage)
			this.current = this.totalPage;
		if (this.current < 1)
			this.current = 1;

		if (reverse)
			this.current = this.totalPage - this.current + 1;

		this.start = (this.current - 1) * this.pageSize;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public boolean isPre() {
		this.pre = this.current > 1;
		return pre;
	}

	public void setPre(boolean pre) {
		this.pre = pre;
	}

	

	public boolean isNext() {
		return next;
	}

	public void setNext(boolean next) {
		this.next = next;
	}

	public boolean isReverse() {
		return reverse;
	}

	public void setReverse(boolean reverse) {
		this.reverse = reverse;
	}
	public List<String> getDates() {
		return dates;
	}

	public void setDates(List<String> dates) {
		this.dates = dates;
	}
}
